<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title></title>  
    <link rel="stylesheet" href="__STATIC__/admin/css/pintuer.css">
    <link rel="stylesheet" href="__STATIC__/admin/css/admin.css">
    <script src="__STATIC__/admin/js/jquery.js"></script>
    <script src="__STATIC__/admin/js/pintuer.js"></script>  
</head>
<body>
<form method="post" action="{:url('Messagn/del')}">
  <div class="panel admin-panel">
    <div class="panel-head"><strong class="icon-reorder"> 留言管理</strong></div>
    <div class="padding border-bottom">
      <ul class="search">
        <li>
          <button type="button"  class="button border-green" id="checkall"><span class="icon-check"></span> 全选</button>
          <button type="submit" class="button border-red"><span class="icon-trash-o"></span> 批量删除</button>
        </li>
      </ul>
    </div>
    <table class="table table-hover text-center">
      <tr>
        <th width="120">ID</th>
        <th>姓名</th>       
        <th>电话</th>
        <th>邮箱</th>
        <th width="40%">内容</th>
         <th width="120">留言时间</th>
        <th>操作</th>       
      </tr>    
      {volist name='list' id='list' empty="暂时没有数据"}
      <tr>
        <td><input type="checkbox" name="id[]" value="{$list.id}" />{$list.id}</td>
        <td>{$list.name}</td>
        <td>{$list.phone}</td>
        <td>{$list.email}</td>      
        <td>{$list.content}</td>
        <td>{$list.time}</td>
        <td><div class="button-group"> <a class="button border-red" href="javascript:void(0)" onclick="return del({$list.id})"><span class="icon-trash-o"></span> 删除</a> </div></td>
      </tr>
      {/volist}
      <tr>
        <td colspan="8">
          <div class="pagelist">
            <a href="{:url('Messagn/index')}?page=1">首页</a>
            
            {if condition="$page-2 gt 0"}<!--显示前两页及上一页-->
            <a href="{:url('Messagn/index')}?page={$page-1}">上一页</a>
              {if condition="$page-4 gt 0"}<!--当前页为最后页，为了美观前面多显示两页-->
              <a href="{:url('Messagn/index')}?page={$page-4}">{$page-4}</a>
              <a href="{:url('Messagn/index')}?page={$page-3}">{$page-3}</a>
              {elseif condition="$page-3 gt 0"}<!--当前页为倒数第二页，为了美观前面多显示一页-->
              <a href="{:url('Messagn/index')}?page={$page-3}">{$page-3}</a>
              {/if}
            <a href="{:url('Messagn/index')}?page={$page-2}">{$page-2}</a>
            <a href="{:url('Messagn/index')}?page={$page-1}">{$page-1}</a>
            {elseif condition="$page-1 gt 0"}<!--显示前一页及上一页-->
            <a href="{:url('Messagn/index')}?page={$page-1}">上一页</a>
            <a href="{:url('Messagn/index')}?page={$page-1}">{$page-1}</a>
            {else}
            <span class="">上一页</span>
            {/if}

            <span class="current">{$page}</span>

            {if condition="$page+2 elt $pagetotal"}<!--显示后两页及下一页-->
            <a href="{:url('Messagn/index')}?page={$page+1}">{$page+1}</a>
            <a href="{:url('Messagn/index')}?page={$page+2}">{$page+2}</a>
              {if condition="$page eq 1 && $pagetotal egt $page+4"}<!--当前页为第一页，为了美观后面多显示两页-->
              <a href="{:url('Messagn/index')}?page={$page+3}">{$page+3}</a>
              <a href="{:url('Messagn/index')}?page={$page+4}">{$page+4}</a>
              {elseif condition="$page eq 1 && $pagetotal egt $page+3"}
              <a href="{:url('Messagn/index')}?page={$page+3}">{$page+3}</a>
              {elseif condition="$page eq 2 && $pagetotal egt $page+3"}<!--当前页为第二页，为了美观后面多显示一页-->
              <a href="{:url('Messagn/index')}?page={$page+3}">{$page+3}</a>
              {/if}
            <a href="{:url('Messagn/index')}?page={$page+1}">下一页</a>
            {elseif condition="$page+1 elt $pagetotal"}<!--显示后一页及下一页-->
            <a href="{:url('Messagn/index')}?page={$page+1}">{$page+1}</a>
            <a href="{:url('Messagn/index')}?page={$page+1}">下一页</a>
            {else}
            <span class="">下一页</span>
            {/if}

            <a href="{:url('Messagn/index')}?page={$pagetotal}">尾页</a>
            <span class=""><b style="color: red;">{$page}</b>/{$pagetotal}</span>
            <span><input id="go" style="border: 0; width: 25px;"></span>
            <a href="javascript:void(0)" onclick="return go()">GO</a>
          </div>
        </td>
      </tr>
      
    </table>
  </div>
</form>
<script type="text/javascript">

function del($id){
	if(confirm("您确定要删除吗?")){
		window.location.href='/public/admin/messagn/del/id/'+$id+'.html';
	}
}

function go(){
  $page = document.getElementById("go").value;
  window.location.href='/public/admin/messagn/index.html?page='+$page;
}

$("#checkall").click(function(){ 
  $("input[name='id[]']").each(function(){
	  if (this.checked) {
		  this.checked = false;
	  }
	  else {
		  this.checked = true;
	  }
  });
})

function DelSelect(){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){
		var t=confirm("您确认要删除选中的内容吗？");
		if (t==false) return false; 		
	}
	else{
		alert("请选择您要删除的内容!");
		return false;
	}
}

</script>
</body></html>